<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <%@ include file="/include/service-base-header.jsp" %>
    <title>分销商管理</title>


</head>
<body>
<div class="wrapper">
    <jsp:include page="/include/left_menu.jsp">
        <jsp:param name="index" value="4"/>
    </jsp:include>
    <div class="main-panel">
        <nav class="navbar navbar-expand-lg navigation_shadow_none">
            <div class="container-fluid">
                <div class="navbar-wrapper b-navbar-wapper">
                    <a class="b-navbar-title" style="color: #9c27b0"
                       href="${pageContext.request.contextPath}/s/distribution.do">分销商管理</a>
                    <a class="b-navbar-title" href="${pageContext.request.contextPath}/s/sales-withdraw.do">佣金提现申请</a>
                </div>
            </div>
        </nav>
        <nav class="navbar navbar-expand-lg "
             style="-webkit-box-shadow:0 0 5px rgba(40, 173, 243, 0.0);box-shadow: 0 0 5px rgba(40, 173, 243, 0.0);">
            <div class="container-fluid">
                <div class="navbar-wrapper">
                    <a href="${pageContext.request.contextPath}/s/distribution.do"
                       style="font-size: 0.9rem;margin-left: 0.2rem">分销商管理</a>
                    <span style="font-size: 0.9rem;">&nbsp; / &nbsp;新增分销商</span>
                </div>
            </div>
        </nav>

        <div class="container-fluid">

            <div class="row" style="margin:20px 0px 6px 0px;">
                <div class="col-md-2">姓名*:</div>
                <div class="col-md-4" style="background: white">
                    <input type="text" class="form-control" style="background-image: none" id="name">
                </div>
            </div>
            <div class="row" style="margin:6px 0px">
                <div class="col-md-2">出生年月*:</div>
                <div class="col-md-4" style="background: white">
                    <input type="text" class="datetimepicker" id="event_time"
                           style="width: 100%; padding-top: 7px;padding-bottom: 7px; border:0px;background: transparent;background-image: none">
                </div>
            </div>
            <div class="row" style="margin:6px 0px">
                <div class="col-md-2">性别*:</div>
                <div class="col-md-4" style="padding-left: 0px">
                    <label class="radio-inline" style="margin-top: 7px">
                        <input type="radio" name="sex" id="sex0" value="1" checked>&nbsp;Male
                    </label>
                    <label class="radio-inline" style="margin-top: 7px;margin-left: 20px;">
                        <input type="radio" name="sex" id="sex1" value="0">&nbsp;Female
                    </label>
                </div>
            </div>
            <div class="row" style="margin:6px 0px">
                <div class="col-md-2">城市*:</div>
                <div class="col-md-4" style="background: white">
                    <input type="text" class="form-control" style="background-image: none" id="city">
                </div>
            </div>
            <div class="row" style="margin:6px 0px">
                <div class="col-md-2">地区*:</div>
                <div class="col-md-4" style="background: white">
                    <input type="text" class="form-control" style="background-image: none" id="area">
                </div>
            </div>
            <div class="row" style="margin:6px 0px">
                <div class="col-md-2">电话号码*:</div>
                <div class="col-md-4" style="background: white">
                    <input type="text" class="form-control" style="background-image: none" id="phone">
                </div>
            </div>
            <div class="row" style="margin:6px 0px">
                <div class="col-md-2">Email*:</div>
                <div class="col-md-4" style="background: white">
                    <input type="text" class="form-control" style="background-image: none" id="email">
                </div>
            </div>

            <div class="row" style="margin:30px 0px">
                <div class="col-md-3">
                    <button type="button" onclick="add_sales_click()" class="btn btn-info" style="width: 100%">新增分销商
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    $(function () {
        $('.datetimepicker').datetimepicker({
            icons: {
                time: "fa fa-clock-o",
                date: "fa fa-calendar",
                up: "fa fa-chevron-up",
                down: "fa fa-chevron-down",
                previous: 'fa fa-chevron-left',
                next: 'fa fa-chevron-right',
                today: 'fa fa-screenshot',
                clear: 'fa fa-trash',
                close: 'fa fa-remove'
            },
            format: 'YYYY-MM-DD',
        });
    })

    function add_sales_click() {
        var name = $('#name').val();
        var event_time = $('#event_time').val();
        var sex = $("input[name='sex']:checked").val();
        var city = $('#city').val();
        var area = $('#area').val();
        var phone = $('#phone').val();
        var email = $('#email').val();


        if ("" == name || "" == event_time || "" == city || "" == area || "" == phone || "" == email) {
            showNotification('bottom', 'right', "信息请补全");
            return;
        }

        $.ajax({
            url: baseUrl.base + baseUrl.sales + "/addSales",
            type: 'get',
            data: {
                'salesName': name,
                "birthdayTime": event_time,
                "sales_sex": sex,
                "sales_city": city,
                "sales_area": area,
                "salesPhone": phone,
                "salesEmail": email,
            },
            success: function (data) {
                if (data.code == "0") {
                    window.history.go(-1);
                } else {
                    var res = data.msg;
                    showNotification('bottom', 'right', res);
                }
            }
        });
    }
</script>
</html>